package com.zr.task.utils;

import android.content.Context;
import android.text.TextUtils;

import com.zh.baselibrary.constant.BaseConstant;
import com.zh.baselibrary.utils.ShareManager;
import com.zr.task.constant.Constant;

public class EquipmentTypeUtils {
    private static int boxNum = 0;
    private static String equipmentName = "";
    public static int getBoxNum(Context context) {
        if (boxNum != 0)
            return boxNum;
        if(TextUtils.isEmpty(equipmentName))
         equipmentName = ShareManager.getValue(context, BaseConstant.DEVICE_TYPE);
        //equipmentName = "ZXY-11N";
        int index = equipmentName.indexOf("-");
        if (index == -1)
            return 8;
        index++;
        boxNum = Integer.parseInt(equipmentName.substring(index,equipmentName.length()-1));
        return boxNum;
    }

    public static boolean hasRf(Context context) {
        if(TextUtils.isEmpty(equipmentName))
            equipmentName = ShareManager.getValue(context,BaseConstant.DEVICE_TYPE);
         //equipmentName = "NFZXY-11N";
        if(TextUtils.isEmpty(equipmentName))
            return  false;
        return !equipmentName.contains("NF");
    }
    public static void reSet(){
        boxNum = 0;
         equipmentName = "";
    }
}
